package com.trustasia.action;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trustasia.model.UserModel;
import com.trustasia.util.ResultData;

@Controller
@RequestMapping("/ajax")
public class AjaxAction {
	@RequestMapping(params = "method=test1", method = RequestMethod.GET)
	public @ResponseBody
	Map<String, Object> test1(@RequestParam("name") String name)
			throws UnsupportedEncodingException {
		name = new String(name.getBytes("iso8859-1"), "utf-8");
		System.out.println(name);
		System.out.println("MyAjaxController.test() ...");
		ResultData rd = new ResultData();
		rd.put("info", new UserModel(name, "123456789"));
		
	System.out.println("----------");
		return rd.ok().getMap();
	}

}
